#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "InteractionFragment.h"
#include "NamedElement.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class GeneralOrdering;
class Lifeline;

/// <summary>
/// OccurrenceSpecification
/// An OccurrenceSpecification is the basic semantic unit of Interactions. The
/// sequences of occurrences specified by them are the meanings of Interactions.
/// </summary>
class UMLMODEL_EXPORT OccurrenceSpecification : public NamedElement, public InteractionFragment {

public: // Constructors and destructors
    explicit OccurrenceSpecification(const QString& umlType="uml::OccurrenceSpecification");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// covered getter
    /// References the Lifeline on which the OccurrenceSpecification appears.
    /// </summary>
    shared_ptr<Lifeline> covered() const;

    /// <summary>
    /// covered setter
    /// References the Lifeline on which the OccurrenceSpecification appears.
    /// </summary>
    void setCovered(shared_ptr<Lifeline> value);

    /// <summary>
    /// toAfters getter
    /// References the GeneralOrderings that specify EventOcurrences that must occur
    /// after this OccurrenceSpecification.
    /// </summary>
    vector<shared_ptr<GeneralOrdering>>& toAfters();

    /// <summary>
    /// toBefores getter
    /// References the GeneralOrderings that specify EventOcurrences that must occur
    /// before this OccurrenceSpecification.
    /// </summary>
    vector<shared_ptr<GeneralOrdering>>& toBefores();

private: // Fields
    /// <summary>
    /// covered
    /// References the Lifeline on which the OccurrenceSpecification appears.
    /// </summary>
    shared_ptr<Lifeline> covered_;

    /// <summary>
    /// toAfters
    /// References the GeneralOrderings that specify EventOcurrences that must occur
    /// after this OccurrenceSpecification.
    /// </summary>
    vector<shared_ptr<GeneralOrdering>> toAfters_;

    /// <summary>
    /// toBefores
    /// References the GeneralOrderings that specify EventOcurrences that must occur
    /// before this OccurrenceSpecification.
    /// </summary>
    vector<shared_ptr<GeneralOrdering>> toBefores_;

};

} // namespace uml
